<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
			this.back()
		},
		onShow: function() {
			console.log('App Show')
			this.appletUserCenter()// 判断token是否过期
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			appletUserCenter: function () {
				let that = this
				uni.request({
					url: that.global.url+'api/qianyu_dzq/applet_user_center',
					method: 'POST',
					header:{'site-id':that.global.site_id, "token": uni.getStorageSync('inuse_userinfo_token')},
					data: {type: 1},
					success(res) {
					    let result = res.data
					    if(result.code != 1){
							// uni.clearStorageSync()
					    }
					}
				})
			},
			back: function () {
				let that = this
				uni.request({
					url: that.global.url+'api/qianyu_dzq/applet_setting',
					method: 'POST',
					header:{'site-id':that.global.site_id},
					data: {type: 1},
					success(res) {
					    let result = res.data
					    if(result.code == 1){
							uni.setStorageSync('back', result.data.main_theme_color)
							uni.setStorageSync('backTwo', result.data.subtopic_color)
							uni.setStorageSync('site_id', result.data.site_id)
							uni.setStorageSync('appid', result.data.appid)
							uni.setStorageSync('secret', result.data.secret)
							console.log('系统信息已储存')
							console.log('主色调'+result.data.main_theme_color)
					    }else{
							uni.clearStorageSync()
					        uni.showToast({
					            title: result.msg,
					            icon:'none',
								duration: 2000
					        })
					    }
					},
					complete() {
						uni.hideLoading()
					}
				})
			}
		}
	}
</script>

<style>
	/*每个页面公共css */
	.fowe800{
		font-weight: 800;
	}
	.fowe600{
		font-weight: 600;
	}
	.fofa{
		font-family: initial;
	}
	.dis{
		display: flex;
	}
	.disAl{
		align-items: center;
	}
	.disJuC{
		justify-content: center;
	}
	.disJuB{
		justify-content: space-between;
	}
	.flwa {
	  flex-wrap: wrap;
	}
	.fleDir{
	  flex-direction: column;
	}
	.wid100{
		width: 100%;
	}
	.wid95{
		width: 95%;
	}
	.wid90{
		width: 90%;
	}
	.wid87{
		width: 87%;
	}
	.wid80{
		width: 80%;
	}
	.hei100{
		height: 100%;
	}
	.hei80{
		height: 80rpx;
	}
	.hei87{
		height: 87rpx;
	}
	.hei60{
		height: 60rpx;
	}
	.wh100{
		width: 100%;
		height: 100%;
	}
	.mar{
		margin: auto;
	}
	.mar20{
		margin: 20rpx auto;
	}
	.mar-left10{
		margin-left: 10rpx;
	}
	.mar-right10{
		margin-right: 10rpx;
	}
	.mar-top10{
		margin-top: 10rpx;
	}
	.mar-bott10{
		margin-bottom: 10rpx;
	}
	.mar-left20{
		margin-left: 20rpx;
	}
	.mar-right20{
		margin-right: 20rpx;
	}
	.mar-top20{
		margin-top: 20rpx;
	}
	.mar-bott20{
		margin-bottom: 20rpx;
	}
	.mar-left30{
		margin-left: 30rpx;
	}
	.mar-right30{
		margin-right: 30rpx;
	}
	.mar-top30{
		margin-top: 30rpx;
	}
	.mar-bott30{
		margin-bottom: 30rpx;
	}
	.mar-top40{
		margin-top: 40rpx;
	}
	.textCen{
		text-align: center;
	}
	.foSi50{
		font-size: 50rpx;
	}
	.foSi40{
		font-size: 40rpx;
	}
	.foSi35{
		font-size: 35rpx;
	}
	.foSi30{
		font-size: 30rpx;
	}
	.foSi25{
		font-size: 25rpx;
	}
	.foSi20{
		font-size: 20rpx;
	}
	.borRad10{
		border-radius: 10rpx;
	}
	.borRad20{
		border-radius: 20rpx;
	}
	.borRad40{
		border-radius: 40rpx;
	}
	.borRad50{
		border-radius: 50%;
	}
	.coFFF{
		color: #fff;
	}
	.bacFFF{
		background-color: #fff;
	}
	.xhx{
		height: 1rpx;
		background-color: #F0F0F0;
	}
	.poFix{
		position: fixed;
	}
	.poAbs{
		position: absolute;
	}
	.poRel{
		position: relative;
	}
	.overflowHidden {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	
	.webkitLineClamp {
		overflow: hidden;
		word-break: break-all;
		/* break-all(允许在单词内换行。) */
		text-overflow: ellipsis;
		/* 超出部分省略号 */
		display: -webkit-box;
		/** 对象作为伸缩盒子模型显示 **/
		-webkit-box-orient: vertical;
		/** 设置或检索伸缩盒对象的子元素的排列方式 **/
		-webkit-line-clamp: 2;
		/** 显示的行数 **/
	}
	.webkitLineClamp3 {
		overflow: hidden;
		word-break: break-all;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
	  white-space: pre-line !important;
	}
	.box{
		box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.05), 5px -5px 5px rgba(0, 0, 0, 0.05),
			-5px 5px 5px rgba(0, 0, 0, 0.05), -5px -5px 5px rgba(0, 0, 0, 0.05);
	}
	.box1{
		box-shadow: 0rpx 2rpx 10rpx 0rpx rgba(0,0,0,0.1);
	}
	.box2{
		box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0,0,0,0.1);
	}
</style>
